#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

int main(int argc, const char **argv) {
    FILE *file = fopen("./a", "w");
    if (!file) {
        perror("error:");
        return -1;
    }
    struct stat info;
    while (1) {
        int ret = stat("./a", &info);
        printf("%d\n", info.st_size);
        ret = fwrite("hello", 1, 5, file);
        printf("%d\n", ret);
        fflush(file);
        sleep(1);
    }

    fclose(file);

    return 0;
}
